//
//  UIVisitiorViewController.swift
//  SinaWeibo
//
//  Created by 统杰李 on 16/7/19.
//  Copyright © 2016年 统杰李. All rights reserved.
//

import UIKit

class HMVisitiorViewController: UIViewController {

    //用户是否登录
    var userLogon: Bool = false
    
    //访客视图view
    var visitorView: HMVistorView?
    
    // MARK: - 监听方法
    @objc private func loginClick(){
        
        print("登录注册按钮点击")
    }
    
    override func loadView() {
        
//        if userLogon {
//            
//            super.loadView()
//            
//        }else{
//            
//            view = vistorView
//        }
        
        
        userLogon ? super.loadView() : setupVistorView()
        
    }
    // MARK: - 设置访客视图
    private func setupVistorView(){
        
        visitorView = HMVistorView()
        visitorView?.closure = {
            print("登录或者注册按钮点击")
        }
        view = visitorView

        setupNav()
    }
    
    // MARK: - 设置导航栏按钮
    func setupNav(){
        
        navigationItem.leftBarButtonItem = UIBarButtonItem(title: "登录", target: self, action: "loginClick")
        
        navigationItem.rightBarButtonItem = UIBarButtonItem(title: "注册", target: self, action: "loginClick")
        
        
    }
    
    override func viewDidLoad() {
        super.viewDidLoad()
    }
    
    func setupUI(){
        
    }
    
    // MARK: - 懒加载控件
//    private lazy var vistorView: HMVistorView = HMVistorView()
    lazy var tableView: UITableView = UITableView()
    
    
  }
